<?php
  use yii\bootstrap\Nav;
  use \yii\helpers\Url;

?>

<ul class="nav" id="side-menu">
    <li class="nav-header">
        <div class="dropdown profile-element">
            <span><img alt="image" class="img-circle" src="/static/site/profile_small.jpg"  /></span>
            <a data-toggle="dropdown" class="dropdown-toggle" href="#">
                <span class="clear">
               <span class="block m-t-xs"><strong class="font-bold"><?php echo Yii::$app->user->identity->username ?></strong></span>
                <span class="text-muted text-xs block">超级管理员<b class="caret"></b></span>
                </span>
            </a>
            <ul class="dropdown-menu animated fadeInRight m-t-xs">
                <li><a class="J_menuItem" href="#" >修改头像</a></li>
                <li class="divider"></li>
                <li><a href="#" >安全退出</a></li>
            </ul>
        </div>
        <div class="logo-element">H+</div>
    </li>
    <li>
      <a class="J_menuItem"  href="/gii">
        <i class="fa fa-circle-o"></i>
        <span class="nav-label">gii</span>
      </a>
    </li>



    <li>
        <a href="#">
            <i class="fa fa-home"></i>
            <span class="nav-label">rbac</span>
            <span class="fa arrow"></span>
        </a>
        <ul class="nav nav-second-level">
              <li><a class="J_menuItem"  href="/rbac/route"><i class="fa fa-circle-o"></i> 路由</a></li>
              <li><a class="J_menuItem"  href="/rbac/permission"><i class="fa fa-circle-o"></i> 权限</a></li>
              <li><a class="J_menuItem"  href="/rbac/role"><i class="fa fa-circle-o"></i> 角色</a></li>
              <li><a class="J_menuItem"  href="/rbac/rule"><i class="fa fa-circle-o"></i> 规则</a></li>
              <li><a class="J_menuItem"  href="/rbac/assignment"><i class="fa fa-circle-o"></i> 分配</a></li>
              <li><a class="J_menuItem"  href="/rbac/menu"><i class="fa fa-circle-o"></i> 菜单</a></li>
        </ul>
    </li>
<!--
auth-assignment
auth-item
auth-item-child
auth-rule
auth-menu
-->

    <?php
     $menu_arr =   backend\modules\rbac\components\MenuHelper::getAssignedMenu(Yii::$app->user->id);
     // var_dump($menu_arr);
    foreach($menu_arr as $rs):
    ?>

      <li>
      <a class="J_menuItem"  href="<?php echo $rs['url'][0];//echo Url::to(['news/index'])  ?>">
        <i class="fa fa-circle-o"></i>
        <span class="nav-label"><?php echo $rs['label']; ?></span>
      </a>
      <?php
        if(!empty($rs['items'])){
          ?>
        <ul class="nav nav-second-level">
          <?php
          foreach($rs['items'] as $row):
            ?>
            <li><a class="J_menuItem"  href="<?php echo $row['url'][0]; ?>"><i class="fa fa-circle-o"></i> <?php echo $row['label']; ?></a></li>
          <?php endforeach; ?>
        </ul>
      <?php
        }
      ?>

    </li>

    <?php endforeach; ?>


    <!--
    <li>
        <a href="#">
            <i class="fa fa-home"></i>
            <span class="nav-label">主页</span>
            <span class="fa arrow"></span>
        </a>
        <ul class="nav nav-second-level">
            <li>
                <a class="J_menuItem" href="#"  data-index="0">主页示例一</a>
            </li>
            <li>
                <a class="J_menuItem" href="#" >主页示例二</a>
            </li>
            <li>
                <a class="J_menuItem" href="#" >主页示例三</a>
            </li>
            <li>
                <a class="J_menuItem" href="#" >主页示例四</a>
            </li>
            <li>
                <a href="#"  target="_blank">主页示例五</a>
            </li>
        </ul>
    </li>
    <li>
        <a class="J_menuItem" href="#" ><i class="fa fa-columns"></i> <span class="nav-label">布局</span></a>
    </li>
    <li>
        <a href="#">
            <i class="fa fa fa-bar-chart-o"></i>
            <span class="nav-label">统计图表</span>
            <span class="fa arrow"></span>
        </a>
        <ul class="nav nav-second-level">
            <li>
                <a class="J_menuItem" href="#" >百度ECharts</a>
            </li>
            <li>
                <a class="J_menuItem" href="#" >Flot</a>
            </li>
            <li>
                <a class="J_menuItem" href="#" >Morris.js</a>
            </li>
            <li>
                <a class="J_menuItem" href="#" >Rickshaw</a>
            </li>
            <li>
                <a class="J_menuItem" href="#" >Peity</a>
            </li>
            <li>
                <a class="J_menuItem" href="#" >Sparkline</a>
            </li>
            <li>
                <a class="J_menuItem" href="#" >图表组合</a>
            </li>
        </ul>
    </li>

    <li>
        <a href="#" ><i class="fa fa-envelope"></i> <span class="nav-label">信箱 </span><span class="label label-warning pull-right">16</span></a>
        <ul class="nav nav-second-level">
            <li><a class="J_menuItem" href="#" >收件箱</a>
            </li>
            <li><a class="J_menuItem" href="#" >查看邮件</a>
            </li>
            <li><a class="J_menuItem" href="#" >写信</a>
            </li>
        </ul>
    </li>
    <li>
        <a href="#"><i class="fa fa-edit"></i> <span class="nav-label">表单</span><span class="fa arrow"></span></a>
        <ul class="nav nav-second-level">
            <li><a class="J_menuItem" href="#" >基本表单</a>
            </li>
            <li><a class="J_menuItem" href="#" >表单验证</a>
            </li>
            <li><a class="J_menuItem" href="#" >高级插件</a>
            </li>
            <li><a class="J_menuItem" href="#" >表单向导</a>
            </li>
            <li>
                <a href="#">文件上传 <span class="fa arrow"></span></a>
                <ul class="nav nav-third-level">
                    <li><a class="J_menuItem" href="#" >百度WebUploader</a>
                    </li>
                    <li><a class="J_menuItem" href="#" >DropzoneJS</a>
                    </li>
                    <li><a class="J_menuItem" href="#" >头像裁剪上传</a>
                    </li>
                </ul>
            </li>
            <li>
                <a href="#">编辑器 <span class="fa arrow"></span></a>
                <ul class="nav nav-third-level">
                    <li><a class="J_menuItem" href="#" >富文本编辑器</a>
                    </li>
                    <li><a class="J_menuItem" href="#" >simditor</a>
                    </li>
                    <li><a class="J_menuItem" href="#" >MarkDown编辑器</a>
                    </li>
                    <li><a class="J_menuItem" href="#" >代码编辑器</a>
                    </li>
                </ul>
            </li>
            <li><a class="J_menuItem" href="#" >搜索自动补全</a>
            </li>
            <li><a class="J_menuItem" href="#" >日期选择器layerDate</a>
            </li>
        </ul>
    </li>
    <li>
        <a href="#"><i class="fa fa-desktop"></i> <span class="nav-label">页面</span><span class="fa arrow"></span></a>
        <ul class="nav nav-second-level">
            <li><a class="J_menuItem" href="#" >联系人</a>
            </li>
            <li><a class="J_menuItem" href="#" >个人资料</a>
            </li>
            <li>
                <a href="#">项目管理 <span class="fa arrow"></span></a>
                <ul class="nav nav-third-level">
                    <li><a class="J_menuItem" href="#" >项目</a>
                    </li>
                    <li><a class="J_menuItem" href="#" >项目详情</a>
                    </li>
                </ul>
            </li>
            <li><a class="J_menuItem" href="#" >团队管理</a>
            </li>
            <li><a class="J_menuItem" href="#" >信息流</a>
            </li>
            <li><a class="J_menuItem" href="#" >客户管理</a>
            </li>
            <li><a class="J_menuItem" href="#" >文件管理器</a>
            </li>
            <li><a class="J_menuItem" href="#" >日历</a>
            </li>
            <li>
                <a href="#">博客 <span class="fa arrow"></span></a>
                <ul class="nav nav-third-level">
                    <li><a class="J_menuItem" href="#" >文章列表</a>
                    </li>
                    <li><a class="J_menuItem" href="#" >文章详情</a>
                    </li>
                </ul>
            </li>
            <li><a class="J_menuItem" href="#" >FAQ</a>
            </li>
            <li>
                <a href="#">时间轴 <span class="fa arrow"></span></a>
                <ul class="nav nav-third-level">
                    <li><a class="J_menuItem" href="#" >时间轴</a>
                    </li>
                    <li><a class="J_menuItem" href="#" >时间轴v2</a>
                    </li>
                </ul>
            </li>
            <li><a class="J_menuItem" href="#" >标签墙</a>
            </li>
            <li>
                <a href="#">单据 <span class="fa arrow"></span></a>
                <ul class="nav nav-third-level">
                    <li><a class="J_menuItem" href="#" >单据</a>
                    </li>
                    <li><a class="J_menuItem" href="#" >单据打印</a>
                    </li>
                </ul>
            </li>
            <li><a class="J_menuItem" href="#" >搜索结果</a>
            </li>
            <li><a class="J_menuItem" href="#" >论坛</a>
            </li>
            <li>
                <a href="#">即时通讯 <span class="fa arrow"></span></a>
                <ul class="nav nav-third-level">
                    <li><a class="J_menuItem" href="#" >聊天窗口</a>
                    </li>
                    <li><a class="J_menuItem" href="#" >layIM</a>
                    </li>
                </ul>
            </li>
            <li>
                <a href="#">登录注册相关 <span class="fa arrow"></span></a>
                <ul class="nav nav-third-level">
                    <li><a href="#"  target="_blank">登录页面</a>
                    </li>
                    <li><a href="#"  target="_blank">登录页面v2</a>
                    </li>
                    <li><a href="#"  target="_blank">注册页面</a>
                    </li>
                    <li><a href="#"  target="_blank">登录超时</a>
                    </li>
                </ul>
            </li>
            <li><a class="J_menuItem" href="#" >404页面</a>
            </li>
            <li><a class="J_menuItem" href="#" >500页面</a>
            </li>
            <li><a class="J_menuItem" href="#" >空白页</a>
            </li>
        </ul>
    </li>
    <li>
        <a href="#"><i class="fa fa-flask"></i> <span class="nav-label">UI元素</span><span class="fa arrow"></span></a>
        <ul class="nav nav-second-level">
            <li><a class="J_menuItem" href="#" >排版</a>
            </li>
            <li>
                <a href="#">字体图标 <span class="fa arrow"></span></a>
                <ul class="nav nav-third-level">
                    <li>
                        <a class="J_menuItem" href="#" >Font Awesome</a>
                    </li>
                    <li>
                        <a class="J_menuItem" href="#" >Glyphicon</a>
                    </li>
                    <li>
                        <a class="J_menuItem" href="#" >阿里巴巴矢量图标库</a>
                    </li>
                </ul>
            </li>
            <li>
                <a href="#">拖动排序 <span class="fa arrow"></span></a>
                <ul class="nav nav-third-level">
                    <li><a class="J_menuItem" href="#" >拖动面板</a>
                    </li>
                    <li><a class="J_menuItem" href="#" >任务清单</a>
                    </li>
                </ul>
            </li>
            <li><a class="J_menuItem" href="#" >按钮</a>
            </li>
            <li><a class="J_menuItem" href="#" >选项卡 &amp; 面板</a>
            </li>
            <li><a class="J_menuItem" href="#" >通知 &amp; 提示</a>
            </li>
            <li><a class="J_menuItem" href="#" >徽章，标签，进度条</a>
            </li>
            <li>
                <a class="J_menuItem" href="#" >栅格</a>
            </li>
            <li><a class="J_menuItem" href="#" >视频、音频</a>
            </li>
            <li>
                <a href="#">弹框插件 <span class="fa arrow"></span></a>
                <ul class="nav nav-third-level">
                    <li><a class="J_menuItem" href="#" >Web弹层组件layer</a>
                    </li>
                    <li><a class="J_menuItem" href="#" >模态窗口</a>
                    </li>
                    <li><a class="J_menuItem" href="#" >SweetAlert</a>
                    </li>
                </ul>
            </li>
            <li>
                <a href="#">树形视图 <span class="fa arrow"></span></a>
                <ul class="nav nav-third-level">
                    <li><a class="J_menuItem" href="#" >jsTree</a></li>
                    <li><a class="J_menuItem" href="#" >Bootstrap Tree View</a></li>
                    <li><a class="J_menuItem" href="#" >nestable</a></li>
                </ul>
            </li>
            <li><a class="J_menuItem" href="#" >Toastr通知</a>
            </li>
            <li><a class="J_menuItem" href="#" >文本对比</a>
            </li>
            <li><a class="J_menuItem" href="#" >加载动画</a>
            </li>
            <li><a class="J_menuItem" href="#" >小部件</a>
            </li>
        </ul>
    </li>
    <li>
        <a href="#"><i class="fa fa-table"></i> <span class="nav-label">表格</span><span class="fa arrow"></span></a>
        <ul class="nav nav-second-level">
            <li><a class="J_menuItem" href="#" >基本表格</a>
            </li>
            <li><a class="J_menuItem" href="#" >DataTables</a>
            </li>
            <li><a class="J_menuItem" href="#" >jqGrid</a>
            </li>
            <li><a class="J_menuItem" href="#" >Foo Tables</a>
            </li>
            <li><a class="J_menuItem" href="#" >Bootstrap Table
                <span class="label label-danger pull-right">推荐</span></a>
            </li>
        </ul>
    </li>
    <li>
        <a href="#"><i class="fa fa-picture-o"></i> <span class="nav-label">相册</span><span class="fa arrow"></span></a>
        <ul class="nav nav-second-level">
            <li><a class="J_menuItem" href="#" >基本图库</a>
            </li>
            <li><a class="J_menuItem" href="#" >图片切换</a>
            </li>
            <li><a class="J_menuItem" href="#" >layer相册</a>
            </li>
            <li><a class="J_menuItem" href="#" >Blueimp相册</a>
            </li>
        </ul>
    </li>
    <li>
        <a class="J_menuItem" href="#" ><i class="fa fa-magic"></i> <span class="nav-label">CSS动画</span></a>
    </li>
    <li>
        <a href="#"><i class="fa fa-cutlery"></i> <span class="nav-label">工具 </span><span class="fa arrow"></span></a>
        <ul class="nav nav-second-level">
            <li><a class="J_menuItem" href="#" >表单构建器</a>
            </li>
        </ul>
    </li>-->

</ul>
